package org.miaosha.service;

import org.miaosha.mapper.TestMapper;
import org.miaosha.model.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Wrb
 * @date 2019/7/10 11:07
 */
@Service
public class TestService {

	@Autowired
	private TestMapper testMapper;

	public Test selectTestByKey(Integer id){
		return testMapper.selectByPrimaryKey(id);
	}

	@Transactional
	public int insertTestTx() {
		Test test = new Test();
		test.setName("test");
		testMapper.insert(test);
		test.setId(1);
		return testMapper.insert(test);
	}
}
